/*

    This file is part of Hometree.

    Hometree is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Hometree is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Hometree.  If not, see <http://www.gnu.org/licenses/>.

    Copyright 2011,2012 Roman Held

*/
#include "cv.h"
#include "highgui.h"
#include <QObject>
#include <QTimer>
#include <QImage>

class CvCam : public QObject
{
  Q_OBJECT
  public:
    CvCam(const QString &aviFileName, QObject *parent = NULL);
    CvCam(int camId = -1, QObject *parent = NULL);
    virtual ~CvCam();

    void init(int camId);

  signals:
    void frame(const QImage  &image);
    void frame(const QPixmap &pixmap);

  public slots: 
    void capture();
    void convert();

  private:
    QTimer      mTimerCapture;
    QTimer      mTimerConverter;
    CvCapture  *mCapture;
    IplImage   *mFrame;
};

